package org.example.memora.Repository;

import org.springframework.data.domain.Page;

import org.example.memora.entity.Comment;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;
import org.springframework.data.domain.Pageable;


import java.util.List;

@Repository
public interface CommentRepository extends MongoRepository<Comment, String> {
    List<Comment> findByArticleId(String articleId);
    // 额外的自定义查询（如需要）
    List<Comment> findByArticleIdAndParentId(String articleId, String parentId);
    List<Comment> findByArticleIdAndState(String articleId, Integer state);
    List<Comment> findByParentId(String parentId);
    List<Comment> findByArticleIdOrderByCreatedAtDesc(String articleId);
    Page<Comment> findByArticleId(String articleId, Pageable pageable);

    void deleteByArticleId(String articleId);


}

